import threading
import time
import random
from Queue import Queue

class Producer(threading.Thread):
    def __init__(self, queue):
        self.queue = queue
        threading.Thread.__init__(self)

    def run(self):
        lista = []
        while 1:
            if self.queue.qsize() > 0:
                
                qdata = self.queue.get(i)
                lista.append(qdata)
                time.sleep(random.randint(10, 100) / 1000.0)
                print lista
            else:
                break

def doJob(data):
    print "threading:", data

q = Queue(0)
for i in range(10):
    q.put(i)
da = []
for i in range(2):
    Producer(q).start()


    
